home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Stonewall.dxr / Internal_23_New Behavior.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  669 b   |  24 lines

  1. property pSpider, spriteNum, pTimeout, pDirection
  2.  
  3. on beginSprite me
  4.   pSpider = sprite(spriteNum)
  5.   pDirection = -1
  6.   pTimeout = timeout("spider3").new(25, #crawl, me)
  7.   pSpider.flipH = 0
  8. end
  9.  
  10. on crawl me
  11.   pSpider.locH = pSpider.locH + pDirection
  12.   if (pSpider.locH > ((the stage).rect.width + pSpider.width)) or (pSpider.locH < (0 - pSpider.width)) then
  13.     pDirection = pDirection * -1
  14.     the randomSeed = the ticks
  15.     pSpider.locH = random((the stage).rect.width)
  16.     pSpider.flipH = not pSpider.flipH
  17.     if pSpider.locH > (the stage).rect.width then
  18.       pSpider.locH = (the stage).rect.width - 10
  19.     else
  20.       pSpider.locH = 0 + 10
  21.     end if
  22.   end if
  23. end
  24.